export default {
  namespaced: true,
  state: () => {
    return {
      historys: []
    }
  },
  mutations: {
    // 新增 不可出现重复
    addHistory(state, payload) {
      const obj = state.historys.findIndex(item => item == payload)
      if (obj !== -1) {
        state.historys.splice(obj, 1)
      }
      state.historys.unshift(payload)
    },
    // 单个删除
    deleteSingleHistory(state, index) {
      state.historys.splice(index, 1)
    },
    // 全部删除
    deleteAllHistory(state) {
      state.historys = []
    }
  },
  actions: {}
}
